home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 201-225 / disk_214 / mandelvroom / src / status.c < prev    next >
C/C++ Source or Header  |  1992-05-06  |  4KB  |  161 lines

  1. /*
  2.  * MandelVroom 2.0
  3.  *
  4.  * (c) Copyright 1987,1989  Kevin L. Clague, San Jose, CA
  5.  *
  6.  * All rights reserved.
  7.  *
  8.  * Permission is hereby granted to distribute this program's source
  9.  * executable, and documentation for non-comercial purposes, so long as the
  10.  * copyright notices are not removed from the sources, executable or
  11.  * documentation.  This program may not be distributed for a profit without
  12.  * the express written consent of the author Kevin L. Clague.
  13.  *
  14.  * This program is not in the public domain.
  15.  *
  16.  * Fred Fish is expressly granted permission to distribute this program's
  17.  * source and executable as part of the "Fred Fish freely redistributable
  18.  * Amiga software library."
  19.  *
  20.  * Permission is expressly granted for this program and it's source to be
  21.  * distributed as part of the Amicus Amiga software disks, and the
  22.  * First Amiga User Group's Hot Mix disks.
  23.  *
  24.  * contents: this file contains functions to open, display and close the
  25.  * statistics window.
  26.  */
  27.  
  28. #include "mandp.h"
  29.  
  30. struct Window *StatsWind;
  31.  
  32. UBYTE StatsOpen;
  33.  
  34. static
  35. struct NewWindow NewStats = {
  36.    0,200-100,                /* start position           */
  37.    90,120,                   /* width, height            */
  38.    (UBYTE) 0, (UBYTE) 1,     /* detail pen, block pen    */
  39.    NULL,                     /* IDCMP flags */
  40.                              /* MandWind flags */
  41.    WINDOWCLOSE | WINDOWDRAG | WINDOWDEPTH | SMART_REFRESH,
  42.    (struct Gadget *) NULL,   /* first gadget             */
  43.    (struct Image *) NULL,    /* user checkmark           */
  44.    (UBYTE *) "Statistics",   /* window title             */
  45.    (struct Screen *) NULL,   /* pointer to screen        */
  46.    (struct BitMap *) NULL,   /* pointer to superbitmap   */
  47.    80,80,80,80,              /* sizing                   */
  48.    CUSTOMSCREEN              /* type of screen           */
  49. };
  50.  
  51. static
  52. UBYTE StartString[80], EndString[80], GapString[80], SizeString[80];
  53. static
  54. UBYTE MagString[30];
  55.  
  56. static
  57. struct IntuiText MagIntui = {
  58.   1, 0, JAM1, 8, 52, NULL,
  59.   (UBYTE *) MagString, NULL
  60. };
  61.  
  62. static
  63. struct IntuiText SizeIntui = {
  64.   1, 0, JAM1, 8, 44, NULL,
  65.   (UBYTE *) SizeString, &MagIntui
  66. };
  67.  
  68. static
  69. struct IntuiText GapIntui = {
  70.   1, 0, JAM1, 8, 36, NULL,
  71.   (UBYTE *) GapString, &SizeIntui
  72. };
  73.  
  74. static
  75. struct IntuiText EndIntui = {
  76.   1, 0, JAM1, 8, 28, NULL,
  77.   (UBYTE *) EndString, &GapIntui
  78. };
  79.  
  80. static
  81. struct IntuiText StartIntui = {
  82.   1, 0, JAM1, 8, 20, NULL,
  83.   (UBYTE *) StartString, &EndIntui
  84. };
  85.  
  86. static
  87. struct IntuiText RealIntui = {
  88.   1, 0, JAM1, 8, 12, NULL,
  89.   (UBYTE *) "      Real            Imag", &StartIntui
  90. };
  91.  
  92. /*
  93.  * Open the statistics window
  94.  */
  95. OpenStatsWind( Pict )
  96.   struct Picture *Pict;
  97. {
  98.   struct Window *OpenMyWind();
  99.  
  100.   if (StatsWind == (struct Window *) NULL) {
  101.  
  102.     StatsWind = OpenMyWind( &NewStats, screen, NULL, 320, 80);
  103.  
  104.   } else {
  105.     WindowToFront( StatsWind );
  106.   }
  107.   ShowStats( Pict );
  108.   StatsOpen = 1;
  109. } /* OpenStatsWind */
  110.  
  111. /*
  112.  * Close the statistics window
  113.  */
  114. CloseStatsWind()
  115. {
  116.   if (StatsWind != (struct Window *) NULL) {
  117.     CloseMyWind( StatsWind, NULL);
  118.     StatsWind = (struct Window *) NULL;
  119.   }
  120. } /* CloseStatsWind */
  121.  
  122. ShowStats( Pict )
  123.   register struct Picture *Pict;
  124. {
  125.   register LONG  Mag;
  126.  
  127.   if (StatsWind) {
  128.  
  129.     ClearWindow( StatsWind, 0);
  130.  
  131.     Mag = (LONG) 4.0 / (Pict->ImagHigh - Pict->ImagLow);
  132.  
  133.     sprintf( StartString, "Start %15.12f %15.12f", Pict->RealLow,  Pict->ImagLow );
  134.     sprintf( EndString,   "End   %15.12f %15.12f", Pict->RealHigh, Pict->ImagHigh );
  135.     sprintf( GapString,   "Gap   %15.12f %15.12f", Pict->RealGap,  Pict->ImagGap );
  136.     sprintf( SizeString,  "Size  %15d %15d", Pict->CountX,   Pict->CountY );
  137.     sprintf( MagString,   "Mag   %15d", Mag );
  138.  
  139.     PrintIText( StatsWind->RPort, &RealIntui, 0, 0 );
  140.   }
  141. }
  142.  
  143. ClearWindow( Window, pen )
  144.   register struct Window *Window;
  145.   int pen;
  146. {
  147.   register struct RastPort *RPort;
  148.   register LONG bot, right;
  149.  
  150.   RPort = Window->RPort;
  151.  
  152.   SetAPen( RPort, (long) pen);
  153.  
  154.   bot   = Window->Height - Window->BorderBottom;
  155.   right = Window->Width - Window->BorderRight;
  156.  
  157.   RectFill( RPort, Window->BorderLeft-1, Window->BorderTop-1, right, bot );
  158. }
  159.  
  160.  
  161.